import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsInt, Max, Min } from 'class-validator';

/** 分页请求基类 */
export class BasicPagingReqDto {
  @ApiProperty({ description: '页码下标，默认从0开始' })
  @Type(() => Number)
  @IsInt({ message: '页码必须是整数' })
  @Min(0, { message: '页码不得小于0' })
  readonly page_index: number;

  @ApiProperty({ description: '每页大小' })
  @Type(() => Number)
  @IsInt({ message: '每页数量必须是整数' })
  @Min(5, { message: '每页数量不得小于5' })
  @Max(100, { message: '每页数量不得大于100' })
  readonly page_size: number;
}
